<?php require_once('../connections/Infinitus.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_Infinitus, $Infinitus);
$query_rsCorreos = "SELECT * FROM infinitus_correos";
$rsCorreos = mysql_query($query_rsCorreos, $Infinitus) or die(mysql_error());
$row_rsCorreos = mysql_fetch_assoc($rsCorreos);
$totalRows_rsCorreos = mysql_num_rows($rsCorreos);

// Send the headers
header('Content-type: text/xml');
header('Pragma: public');        
header('Cache-control: private');
header('Expires: -1');
?>
<?php echo('<?xml version="1.0" encoding="utf-8"?>'); ?>
<listado_correos>
  <?php if ($totalRows_rsCorreos > 0) { // Show if recordset not empty ?>
  <?php do { ?>
	<correo>
		<?php foreach ($row_rsCorreos as $column=>$value) { ?>
		<?php echo "<".$column.">"; ?><![CDATA[<?php echo $row_rsCorreos[$column]; ?>]]>
        </<?php echo $column; ?>>
		<?php } ?>
	</correo>
    <?php } while ($row_rsCorreos = mysql_fetch_assoc($rsCorreos)); ?>
	<?php } ?>
</listado_correos>

<?php

mysql_free_result($rsCorreos);
?>
